package com.tobeface.wechat.showcase.handler;

import com.tobeface.wechat.message.WeChatMessage;
import com.tobeface.wechat.message.WeChatMessageBuilder;
import com.tobeface.wechat.message.WeChatMessageChannel;
import com.tobeface.wechat.message.handler.ImageMessageHandlerSupport;

/**
 * @author loudyn
 */
public class ImageMessageHandler extends ImageMessageHandlerSupport {

    @Override
    protected void onImageMessageReceived(WeChatMessageChannel channel,
                                          WeChatMessage message,
                                          String picUrl, String mediaId) {

        WeChatMessage outMessage = WeChatMessageBuilder.replyImage(message).mediaId(mediaId).build();
        channel.writeMessage(outMessage);
        channel.flush();
    }
}
